<?php
	class the_gladius {
		function db_exists($name) {
			$data = $this->get_results("SHOW DATABASES");			
			foreach($data as $row) {
				if (strtolower($row["database"]) == strtolower($name)) return true;
			}
			return false;
		}
		function db_create($name) {
		    $name = strtolower($name);
			$this->db->query("CREATE DATABASE $name");
		}
		function db_use($name) {
		    $name = strtolower($name);
			$this->db->query("USE $name");
		}
		
			
		function query($query) {
			$this->db->query($query);
		}
		function drop() {
			$this->db->query("DROP DATABASE ".oh("config.db.name"));
			//$this->db->query("CREATE DATABASE ".oh("config.db.name"));
		}
		function get_results($q) {
			$this->fetch_mode = GLADIUS_FETCH_DEFAULT;
			$data = $this->db->query($q);
			if ($data) {
				$head = $data->Fields();
				$data = $data->GetArray();
				return $data; 
			} else {
				return false;
			}			
		}
	}
?>
